package com.yc.taixin.controller;

import com.yc.taixin.support.utils.DateUtil;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * 测试类
 */
public class Demo1 {

	public static void main(String[] args) {

		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd E");

		for (Date date : getWeekDay()) {
//			System.out.println(dateFormat.format(date));
//			System.out.println(DateUtil.format(date,"yyyy-MM-dd E"));
			System.out.println(DateUtil.format(date,"MM月dd日 E"));

		}

	}

	public static Date[] getWeekDay() {

		Calendar calendar = Calendar.getInstance();

		Date[] dates = new Date[12];

		for (int i = 0; i < 12; i++) {

			if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {//SUNDAY
				--i;
				calendar.add(Calendar.DAY_OF_WEEK, +1);
				continue;
			}
			dates[i] = calendar.getTime();
			calendar.add(Calendar.DATE, 1);
		}
		return dates;
	}

}

